package org.example.service.impl;

import org.example.mapper.ArtifactMaintenanceMapper;
import org.example.pojo.domain.ArtifactMaintenance;
import org.example.service.ArtifactMaintenanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ArtifactMaintenanceServiceImpl implements ArtifactMaintenanceService {

    @Autowired
    private ArtifactMaintenanceMapper artifactMaintenanceMapper;

    @Override
    public List<ArtifactMaintenance> getMaintenancesByArtifactId(Integer artifactId) {
        return artifactMaintenanceMapper.findByArtifactId(artifactId);
    }

    @Override
    public ArtifactMaintenance getMaintenanceById(Integer maintenanceId) {
        return artifactMaintenanceMapper.findById(maintenanceId);
    }

    @Override
    public void addMaintenance(ArtifactMaintenance maintenance) {
        artifactMaintenanceMapper.insertMaintenance(maintenance);
    }

    @Override
    public void updateMaintenance(ArtifactMaintenance maintenance) {
        artifactMaintenanceMapper.updateMaintenance(maintenance);
    }

    @Override
    public void deleteMaintenance(Integer maintenanceId) {
        artifactMaintenanceMapper.deleteMaintenance(maintenanceId);
    }
}
